/*
 * analog.h
 *
 * Created: 2012-07-23 12:25:55
 *  Author: Antrykot
 */ 
#define PILOT_LOW	PORTD &= ~(1 << 0)
#define PILOT_HIGH	PORTD |= (1 << 0)


#define PLL_LOCK PORTD |= (1 << 1);
#define PLL_UNLOCK PORTD &= ~(1 << 1);

#define GEN_ON	PORTD &= ~(1 << 7);
#define GEN_OFF	PORTD |= (1 << 7);

#define ASKING	(PINB & (1 << 2))

#define ASK_ENABLE	EIMSK |= (1 << INT2);
#define ASK_DISABLE	EIMSK &= ~(1 << INT2);

#define T2START	TCCR2B = ( 1 << 0);		// T2 - no prescale
#define T2STOP	TCCR2B = 0;		// T2 - no prescale

extern u8 empty_buffer;

extern u16 freq;

extern u8 period;
extern u8 t2_gen;

extern u16 fnum1,fnum2,fnum3;

extern u8 asknum;

extern u8 uw_alarms;

extern u16 measurment;

extern u8 akal_ask;

extern u16 debug_alarms;

extern u8 empty_buff_delay;

u8 respond();

void set_freq();
void calc_freq();

void calc_num();

void pilot();
void gen_long_pilot();

extern u8 wait_spec;
extern u8 in_kalib;		//gen 3kHZ

extern u16 alfreq[8];
void check_alarms();

